package com.chixing.day10_hashcode_exception.word;

public class Te {
    public static boolean VaribleTset(String s,String t) {
        //判断长度
        if (s.length() != t.length() && s.length()<1 && t.length()>5*104) {
            return false;
        }
        int a = 0;
        for (int i = 0; i < s.length(); i++) {
            //判断是否包含大小写
            if (!Character.isLowerCase(s.charAt(i)) && !Character.isLowerCase(t.charAt(i))) return false;
            if (!s.substring(0, i).contains(String.valueOf(s.charAt(i)))) {
                int connt = 0;
                while (t.indexOf(s.charAt(i), connt) != -1) {
                    connt = t.indexOf(s.charAt(i), connt) + 1;
                    a++;
                }
            }
        }
        if (a == t.length()) return true;
        else return false;
    }

    public static void main(String[] args) {
        String s = "anagram";
        String t = "maagran";
        System.out.println(VaribleTset(s,t));
    }
}
